package history.double_exam.simple;


import java.util.Stack;

public class Test {
    public static void main(String[] args) {
        ListNode listNode1 = new ListNode(1);
        ListNode listNode2 = new ListNode(3);
        ListNode listNode3 = new ListNode(2);
        listNode1.next = listNode2;
        listNode2.next = listNode3;
        System.out.println(1>>1);
    }

    public int hammingWeight(int n) {
        if (n <= 0) return 0;
        int count = 0;
        while(n > 0) {
            if ((n&1) == 1) count++;
            n >>= 1;
        }
        return count;
    }

    public static int[] reversePrint(ListNode head) {
        Stack stack = new Stack();
        while (head != null) {
            stack.add(head.val);
            head = head.next;
        }

        int []result = new int[stack.size()];
        int length = stack.size();
        for (int i = 0; i < length; i++) {
            result[i] = (int)stack.pop();
        }
        return result;
    }
}
